<template>
	<view class="container">
		<view class="header">
			<view class="avatar">
				<image src="/static/head_icon.png" mode="aspectFill"></image>
			</view>
			<view class="username">tom</view>
		</view>

		<view class="menu-list">
			<view class="menu-item" @click="navigateTo('')">
			</view>
			<view class="menu-item" @click="navigateTo('')">
				<image src="/static/UserInfo.png" class="menu-icon"></image>
				<text>个人信息</text>
				<image src="/static/more.png" class="menu-icon-g"></image>
			</view>
			<view class="menu-item" @click="navigateTo('')">
				<image src="/static/purchaseorder.png" class="menu-icon"></image>
				<text>订单列表</text>
				<image src="/static/more.png" class="menu-icon-g"></image>
			</view>
			<view class="menu-item" @click="navigateTo('')">
				<image src="/static/modify-password.png" class="menu-icon"></image>
				<text>修改密码</text>
				<image src="/static/more.png" class="menu-icon-g"></image>
			</view>
			<view class="menu-item" @click="navigateTo('')">
				<image src="/static/yijianfankui.png" class="menu-icon"></image>
				<text>意见反馈</text>
				<image src="/static/more.png" class="menu-icon-g"></image>
			</view>
		</view>

		<button class="logout-btn" @click="logout">退出</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: 'tom'
			}
		},
		methods: {
			navigateTo(page) {
				uni.navigateTo({
					url: `/pages/${page}/${page}`
				})
			},
			logout() {
				uni.showModal({
					content: '确定要退出登录吗?',
					success: (res) => {
						if (res.confirm) {
							uni.removeStorageSync('token')
							uni.reLaunch({
								url: '/pages/my/login'
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.container {
		padding: 0 30rpx;
	}

	.header {
		display: flex;
		align-items: center;
		padding: 30rpx 0;
		margin-bottom: 40rpx;

		.avatar {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;
			overflow: hidden;
			margin-top: 50px;
			margin-left: 50px;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.username {
			font-size: 36rpx;
			margin-top: 50px;
			margin-left: 10px;
			color: #333;
		}
	}

	.menu-list {
		background-color: #fff;
		border-radius: 20rpx;
		overflow: hidden;

		.menu-item {
			display: flex;
			align-items: center;
			padding: 30rpx;
			border-bottom: 3rpx solid #eee;

			text {
				font-size: 32rpx;
			}

			.iconfont {
				margin-right: 20rpx;
				font-size: 36rpx;
				color: #1296db;
			}
		}
	}

	.menu-icon {
		width: 40rpx;
		height: 40rpx;
		margin-right: 20rpx;
	}

	.menu-icon-g {
		width: 40rpx;
		height: 40rpx;
		margin-left: 400rpx;
	}

	.logout-btn {
		height: 88rpx;
		margin-top: 80rpx;
		background-image: linear-gradient(to right, #1296db, #64c8f5);
		color: #fff;
		font-size: 34rpx;
	}
</style>
//完成了个人中心界面设计